home *** CD-ROM | disk | FTP | other *** search
/ The Games Machine 76 / XENIATGM66.iso / Indiana Jones / Indiana Jones.exe / RESOURCE / PREVIEW.GOB / cog_inf_mirrorball.cog < prev    next >
Text File  |  1999-11-15  |  6KB  |  209 lines

  1. # Jones 3D Cog Script
  2. #
  3. # INF_MirrorBall.cog
  4. # Controls the mirrorball lightning trap
  5. #
  6. # [SXC]
  7. #
  8. # (C) 1998 LucasArts Entertainment Co. All Rights Reserved
  9. # ========================================================================================
  10.  
  11. symbols
  12.  
  13.     message     startup
  14.     message     activate
  15.     message     entered
  16.     message     exited
  17.     message     timer
  18.     message     crossed
  19.     message     user0
  20.     
  21.     thing       player                                      local
  22.     
  23.     thing       mirrorball
  24.     
  25.     thing       pad0        linkid=3
  26.     thing       pad1        linkid=3
  27.     thing       pad2        linkid=3
  28.     thing       pad3        linkid=3
  29.     thing       pad4        linkid=3
  30.     thing       pad5        linkid=3
  31.     thing       pad6        linkid=3
  32.     thing       pad7        linkid=3
  33.     
  34.     thing       powerbutton0        linkid=4
  35.     thing       powerbutton1        linkid=4
  36.     
  37.     surface     offsurf0
  38.     surface     offsurf1
  39.     
  40.     surface     onsurf0
  41.     surface     onsurf1
  42.     
  43.     thing       generation_point
  44.     
  45.     thing       lightning_strike                            local
  46.     
  47.     template    sparks=bluesparks                              local
  48.     template    smoke0=+pistol_smoke1                        local
  49.     template    lighthit=+lightninghit                        local
  50.     
  51.     material    lightningmat0=inf_4sfx_lightning_a.mat        local
  52.     material    lightningmat1=inf_4sfx_lightning_b.mat        local
  53.     material    lightningmat2=inf_4sfx_lightning_c.mat        local
  54.     material    lightningmat3=inf_4sfx_lightning_d.mat        local
  55.         
  56.     sound        contact0=gen_lightning_contact_c.wav        local
  57.     sound       contact1=gen_lightning_contact_c.wav        local
  58.     sound       contact2=aet_lightning_04.wav               local
  59.     
  60.     int         count=0                                     local
  61.     int         cnt=0                                       local
  62.     int         target=0                                    local
  63.     int         offflag=0                                   local
  64.     
  65.     vector      player_pos                                  local
  66.     
  67.     keyframe    inShocked=in_activate_medium_shock.key        local
  68.      
  69. end
  70.  
  71.  
  72. code
  73.  
  74. #........................................................................................
  75.  
  76. startup:
  77.  
  78.     player = GetLocalPlayerThing();
  79.     SetTimer(1);
  80.     
  81. return;
  82.  
  83. #........................................................................................
  84.  
  85. timer:
  86.  
  87.     PlaySoundThing(contact0[RandBetween(0, 2)], mirrorball, 1, 5, 15, 0);
  88.     
  89.     //normal operation
  90.     if (target == 0)
  91.     {
  92.         for (cnt = 4; cnt <= RandBetween(5, 12); cnt = cnt + 1)
  93.         {
  94.             lightning_strike = CreatePolylineThing(pad0[RandBetween(0, 7)], generation_point, '0 0 0', lightningmat0[RandBetween(0, 3)], 0.05, 0.05, 0.05);
  95.             Sleep(0.05); 
  96.         }
  97.         SetTimer(1);
  98.     }
  99.     
  100.     //indy is on a pad and is visible
  101.     if ((target == 1) && (IsInvisible() == 0) && (offflag == 0))
  102.     {
  103.         //print("indy gets hit");
  104.         SetActorFlags(player, 0x200000);
  105.         StopThing(player);
  106.         PlaySoundThing(contact0, mirrorball, 1, 5, 15, 0);
  107.         player_pos = VectorAdd(GetThingPos(player), '0 0 0.05');
  108.         CreateThingAtPos(sparks, GetThingSector(player), player_pos, '0 0 0');
  109.         CreateThingAtPos(smoke0, GetThingSector(player), player_pos, '0 0 0');
  110.         CreateThingAtPos(lighthit, GetThingSector(player), player_pos, '0 0 0');
  111.         DamageThing(player, 2000, 0x2, mirrorball);
  112.         //PlayKey(player, inShocked, 4, 0x12, 0);
  113.         for (cnt = 4; cnt <= RandBetween(5, 12); cnt = cnt + 1)
  114.         {
  115.             CreatePolylineThing(generation_point, player, '0 0 0', lightningmat0[RandBetween(0, 3)], 0.05, 0.05, 0.05);
  116.             Sleep(0.05); 
  117.         }
  118.         ClearActorFlags(player, 0x200000);
  119.         SetTimer(1);
  120.     }
  121.     
  122.     //indy is on a pad and is invisible
  123.     if ((target == 1) && (IsInvisible() == 1))
  124.     {
  125.         for (cnt = 4; cnt <= RandBetween(5, 12); cnt = cnt + 1)
  126.         {
  127.             lightning_strike = CreatePolylineThing(pad0[RandBetween(0, 7)], generation_point, '0 0 0', lightningmat0[RandBetween(0, 3)], 0.05, 0.05, 0.05);
  128.             Sleep(0.05); 
  129.         }
  130.         SetTimer(1);
  131.         
  132.     }
  133.     
  134. return;
  135.  
  136. #........................................................................................
  137.  
  138. entered:
  139.  
  140.     //print("indy's current visibility is");
  141.     //printint(IsInvisible());
  142.     //print("setting target to 1");
  143.     target = 1;
  144.     
  145. return;
  146.  
  147. #........................................................................................
  148.  
  149. exited:
  150.  
  151.     //print("indy's current visibility is");
  152.     //printint(IsInvisible());
  153.     //print("setting target to 0");
  154.     target = 0;
  155.     
  156. return;
  157.  
  158. #........................................................................................
  159.  
  160. crossed:
  161.     
  162.     if (((GetSenderRef() == offsurf0) || (GetSenderRef() == offsurf1)) && (offflag == 0))
  163.     {
  164.         SetTimer(0);
  165.     }
  166.     
  167.     if (((GetSenderRef() == onsurf0) || (GetSenderRef() == onsurf1)) && (offflag == 0))
  168.     {
  169.         SetTimer(1);
  170.     }
  171.     
  172. return;
  173.     
  174. #........................................................................................
  175.  
  176. activate:
  177.  
  178.     if ((GetSenderID() == 4) && (offflag == 0))
  179.     {
  180.         offflag = 1;
  181.         MoveToFrame(powerbutton0, 1, 1);
  182.         MoveToFrame(powerbutton1, 1, 1);
  183.         WaitForStop(powerbutton1);
  184.         SetTimer(0);
  185.         //print("shutting off the power to the eyeball");
  186.     }
  187.     
  188. return;
  189.  
  190. #........................................................................................
  191.  
  192. user0:
  193.  
  194.     if (offflag == 0)
  195.     {
  196.         offflag = 1;
  197.         MoveToFrame(powerbutton0, 1, 1);
  198.         MoveToFrame(powerbutton1, 1, 1);
  199.         WaitForStop(powerbutton1);
  200.         SetTimer(0);
  201.         //print("shutting off the power to the eyeball");
  202.     }
  203.     
  204. return;    
  205.  
  206. #........................................................................................
  207.  
  208. end
  209.